/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.wors.android.multirideshare.util.listener;

import android.view.View;
import cz.wors.android.multirideshare.activity.RideShareActivity;
import cz.wors.android.multirideshare.model.Tab;

	public class TabViewChangeListener implements View.OnClickListener
	{
		public Tab index;
		RideShareActivity a;

		public TabViewChangeListener(RideShareActivity a, Tab index) {
			this.index = index;
			this.a = a;
		}
		
		public void onClick(View v) 
		{
			switch (index)
			{
				case JIZDY:
					a.generateLayout();
					a.setDefaultValues();
					//showToast("Jsem na kalendáři jízd", false);
					break;
				case PENIZE:
					a.generateBilanceTables();
					if (a.HISTORY_JIZDY_VISIBLE) {
						a.generateBilanceHistory("jizdy");
					}
					if (a.HISTORY_PLATBY_VISIBLE) {
						a.generateBilanceHistory("platby");
					}
					//showToast("Jsem na bilancích", false);
					break;
				case NASTAVENI:
					a.generateSettings();
					//showToast("Jsem na nastavení", false);
					break;
			}
			
			a.getTabHost().setCurrentTab(index.ordinal());
		}
	}